package com.thenie.chat.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.thenie.chat.pojo.User;
import com.thenie.chat.vo.LoginVo;
import com.thenie.chat.vo.RegisterVo;
import com.thenie.chat.vo.RespBean;
import com.thenie.chat.vo.UserVo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author thenie
 * @since 2022-05-17
 */
public interface IUserService extends IService<User> {

    /**
     * 登陆
     * @param vo
     * @param req
     * @param resp
     * @return
     */
    public RespBean doLogin(LoginVo vo, HttpServletRequest req, HttpServletResponse resp);

    /**
     * 注册
     * @param registerVo
     * @param req
     * @param resp
     * @return
     */
    public RespBean doRegister(RegisterVo registerVo,HttpServletRequest req, HttpServletResponse resp);

    /**
     * 判断邮箱是否存在
     * @param email
     * @return
     */
    public boolean checkEmailIsExist(String email);

    /**
     * 判断用户名是否存在
     * @param username
     * @return
     */
    public boolean checkUsernameIsExist(String username);

    /**
     * 根据用户ID获取用户
     * @param id
     * @return
     */
    public User getUserById(Long id);

    /**
     * 根据用户名获取用户
     * @param username
     * @return
     */
    public User getUserByUsername(String username);

    /**
     * 根据邮箱获取用户
     * @param email
     * @return
     */
    public User getUserByEmail(String email);

    /**
     * 根据userTicket获取user
     * @param ticket
     * @param request
     * @param response
     * @return
     */
    public User getUserByCookie(String ticket, HttpServletRequest request, HttpServletResponse response);

    /**
     * 删除登陆状态，userTicket
     * @param ticket
     * @return
     */
    public Boolean deleteUserTicketFormMe(String ticket);

}
